package com.core.cloundbusinessapi.system.user.enums;



/**
 * @author =====Lqj=====
 * @className CloudSystemUserResultCode
 * @description 云系统用添加、删除、解冻、冻结相关响应编码
 * @create 2024/11/15 13:38
 **/

public enum CloudSystemUserResultCode {


    CODE100001(100001, "添加用户请求参数为空，请检查"),
    CODE100002(100002, "添加用户失败已存在该用户，请检查"),
    CODE100003(100003, "添加用户失败手机号格式不正确，请检查"),

    // ================================添加用户==============================

    CODE100010(100010, "查询用户参数为空，请检查"),
    CODE100011(100011, "查询用户内部异常，请检查"),


    //================================查询用户===============================

    CODE1000020(1000020,"修改用户登陆时间ID为空，请检查");


    private final Integer code;
    private final String msg;

    CloudSystemUserResultCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    // 获取 code 值
    public Integer getCode() {
        return code;
    }

    // 获取 msg 值
    public String getMsg() {
        return msg;
    }

    /**
     * 通过 code 获取枚举项
     */
    public static CloudSystemUserResultCode getByCode(Integer code) {
        if (code == null) {
            throw new IllegalStateException("响应编码不能为空");
        }
        for (CloudSystemUserResultCode resultCode : CloudSystemUserResultCode.values()) {
            if (resultCode.getCode().equals(code)) {
                return resultCode;
            }
        }
        throw new IllegalStateException("编码不存请重试输入,不存在的编码：" + code);
    }
}
